package com.zx.viewlearn.views.touchEvent;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.widget.LinearLayout;

/**
 * Created by zhoux on 2018/1/12.
 * 注释：
 */

public class MyViewGroupA extends LinearLayout {
    String TAG = MyViewGroupA.class.getSimpleName();

    public MyViewGroupA(Context context) {
        super(context);
    }

    public MyViewGroupA(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
//        Log.e("touchEvent", TAG + " dispatchTouchEvent");
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        Log.e("touchEvent", TAG + " onInterceptTouchEvent");
        return super.onInterceptTouchEvent(ev);//true 当前控件直接执行：onTouchEvent，子控件不会执行 ：onInterceptTouchEvent方法，子控件不会执行 onTouchEvent方法,
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.e("touchEvent", TAG + " onTouchEvent");
        return super.onTouchEvent(event);//true 父控件不会执行 onTouchEvent方法
    }
}
